#!/usr/bin/env  bash

CUR_DIR=`pwd`

INVENTORY_DIR="${CUR_DIR}"
PLAYBOOKS_DIR="${CUR_DIR}/../playbooks" 

check_inventory() {
	inv_dir=$(dirname $1)
	if [ ! -e "${inv_dir}/group_vars" ]; then
		echo "${inv_dir}目录缺少group_vars目录"
		exit 1
	fi
}

ansible_playbook() {
	inventory=$1
	check_inventory ${inventory}
	ansible-playbook -i "$@"
}